package com.gexiaobao.pigeon.ui.adapter

import android.graphics.Color
import androidx.core.content.ContextCompat
import com.chad.library.adapter.base.BaseQuickAdapter
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.DataBindBaseViewHolder
import com.gexiaobao.pigeon.app.model.bean.AssignInfo
import com.gexiaobao.pigeon.databinding.ItemBonusDetailBinding

/**
 * @Author      : hxw
 * @Date        : 2024/7/23 10:07
 * @Describe    :
 */
class AdapterBonusDetail : BaseQuickAdapter<AssignInfo, DataBindBaseViewHolder>(R.layout.item_bonus_detail) {
    override fun convert(holder: DataBindBaseViewHolder, item: AssignInfo) {
        val binding = DataBindBaseViewHolder.getBinding(holder) as ItemBonusDetailBinding
        binding.data = item
        binding.executePendingBindings()//防止列表抖动

        if (holder.layoutPosition % 2 == 0) {//偶数
            holder.setBackgroundColor(R.id.llItem, Color.parseColor("#FFF8E6"))
        } else {
            holder.setBackgroundColor(R.id.llItem, ContextCompat.getColor(context, R.color.white))
        }

        holder.setText(R.id.tvItemRank, "第" + item.startProjectRank.toString() + " - " + item.endProjectRank.toString() + "名")
    }
}